package org.example.product.service.storage;

import org.apache.ibatis.annotations.*;
import org.example.product.data.entity.ProductEntity;

@Mapper
public interface ProductEntityMapper {

    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert(value = "insert into t_product_entity(code, name, produce_timestamp) value(#{code}, #{name}, #{produceTimestamp})")
    public Integer insertProduct(ProductEntity productEntity);

    @Select("select * from t_product_entity where id = #{id}")
    public ProductEntity selectProductById(Long productId);

    @Update("update t_product set name = #{name} where id = #{id}")
    public Integer updateProduct(ProductEntity productEntity);

}
